import os

class QuestionLoader:
    def __init__(self, questions_dir='questions'):
        self.questions_dir = questions_dir
        self.default_questions = [
            "法国的首都是什么？",
            "解释一下光合作用的过程",
            "写一首关于海洋的短诗",
            "Python编程语言的主要特点是什么？",
            "量子计算与经典计算有何不同？"
        ]

    def load_questions(self):
        """Load sample questions from file or return default questions"""
        questions_file = os.path.join(self.questions_dir, 'sample_questions.txt')
        try:
            with open(questions_file, 'r', encoding='utf-8') as f:
                questions = [line.strip() for line in f if line.strip()]
                if not questions:
                    print(f"警告: 问题文件 {questions_file} 为空，使用默认问题")
                    return self.default_questions
                return questions
        except FileNotFoundError:
            print(f"警告: 问题文件 {questions_file} 不存在，使用默认问题")
            return self.default_questions 